<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/easycommon.jsp" %>
<!DOCTYPE html>
<html>
<head>
  <title>任务发布</title>
  <meta charset="utf-8">
  <style>
    table {
      font-size: 14px
    }
    a{
      text-decoration:none;
    }
    .tree_toright{
      background: url(${basepath}/assets/easyui/themes/icons/expand.png) no-repeat;
      width:16px;
      margin-left: 3px;
    }
    .tree_read{
      background: url(${basepath}/assets/easyui/themes/icons/read.png) no-repeat;
      width:16px;
      margin-left: 3px;
    }
  </style>
  <script type="text/javascript" src="${basepath}/assets/ztree/jquery.ztree.all-3.5.js"></script>
  <link rel="stylesheet" type="text/css" href="${basepath}/assets/ztree/zTreeStyle.css" />
  <script>
    //用户部门树参数
    var settingmenu = {
      data: {
        simpleData: {
          enable: true
        }
      },
      check: {
        enable: true,
        nocheckInherit: true
      },
      view:{
        addDiyDom: addDiyDom
      }
    };

    var dataX = new Array();dataY = new Array();

    //字段类型下拉,动态下拉会导致批量修改下拉值显示不正确
    var selectColumnData = [{type:"0",typeName:"字符串"},{type:"1",typeName:"日期"},{type:"2",typeName:"数字"},{type:"3",typeName:"富文本"}]
    var selectItemTypeData = [{itemType:"0",itemTypeName:"横向"},{itemType:"1",itemTypeName:"纵向"},]

    var selectedRow;
    var datagrid,datagridX,datagridY; //定义全局变量datagrid

    //批量操作更新下拉，修改中文
    var changeText = function(field,chField,dg){
      var changeRow = dg.datagrid('getSelected');
      if(!changeRow){
        return;
      }
      var index = dg.datagrid('getRowIndex', changeRow);
      var options=new Object();
      options.index=index;
      options.field=field;
      var target_line=dg.datagrid('getEditor',options).target;
      var text=target_line.combobox('getText');
      var rows=dg.datagrid("getRows");
      rows[index][chField]=text;
      //dg.datagrid('refreshRow', index);
    }

    IDMark_A = "_a";
    function addDiyDom(treeId, treeNode) {
      if (!treeNode.hasTrans) return;
      var aObj = $("#" + treeNode.tId + IDMark_A);
      var editStr = "    <a class='tree_read' onclick='writeUserTable(\""+treeNode.taskUserID+"\",\""+selectedRow.tableType+"\");'></a>" ;
      editStr += "    <a class='tree_toright' onclick='showUserTable(\""+treeNode.taskUserID+"\");'></a>" ;
      aObj.after(editStr);
    }

    //查看用户任务模板
    function showUserTable(id){
      $.ajax({
        type: "GET",
        url: "${path}/tasktrans/feTaskUserTable",
        data: {taskUserID:id},
        dataType: 'json',
        success: function (jsonStr) {
          if(jsonStr.status==1){
            if (jsonStr.dataset.length==0) {
              layer.msg("未获取到任务模板数据", {time: 3000, icon: 6});
            }else{
              $("#dataTableX").datagrid('loadData', { total: 0, rows: [] });
              $("#dataTableY").datagrid('loadData', { total: 0, rows: [] });
              dataX = new Array(),dataY = new Array();
              $.each(jsonStr.dataset, function (i,rec) {
                if(rec.itemType==0){//横向字段
                  dataX.push(rec)
                }else if(rec.itemType==1){//纵向字段
                  dataY.push(rec)
                }
              });
              setXYData(dataX,dataY);
            }
            $('#transWin').window('open');
          }else{
            layer.msg(jsonStr.msg, {time: 3000, icon: 6});
          }
        },
        error: function (jqXHR, textStatus, errorThrown) {
          layer.msg("与远程服务器交互异常", {time: 3000, icon: 6});
        }
      });
    }

    //录入用户模板数据
    function writeUserTable(id,tableType){
      if(!tableType){
        layer.msg("表单类型不可为空", {time: 3000, icon: 6});
      }
      plantableData(id,tableType);
    }
	
    function showBitMatrix(index){
    	var rows=$('#dataTable').datagrid('getRows');
    	var row=rows[index];

    	var isGrid=(row.tableType==1?1:0);
    	var url='${path}/tasktrans/getBitMatrix?taskID='+row.id+'&isGrid='+isGrid;
    	
    	$('#bitMatrix').attr('src',url);
    	$('#tipdiv').window('open');
    }

    $(function () {
      datagrid = $('#dataTable').datagrid({
        rownumbers: true,
        //singleSelect:true,
        pagination: true,
        pageSize: 30,
        //singleSelect:false,
        fit: true, //datagrid自适应宽度
        fitColumn: false, //列自适应宽度
        striped: true, //行背景交换
        nowap: true, //列内容多时自动折至第二行
        border: false,
        method:'get',
        idField: 'id', //主键
        url: "${path}/fetask/queryTask",
        columns: [[
          {field: '_operate', title: '操作', width: 260, formatter: formatOper},
          {field: 'title', title: '任务标题', width: 150},
          {field: 'parentName', title: '上级任务', width: 150},
          {field: 'content', title: '任务内容', width: 250},
          {field: 'goal', title: '目标', width: 150},
          {field: 'taskTypeName', title: '任务类型', width: 80},
          {field: 'taskLevelName', title: '任务等级', width: 80},
          {field: 'tablebaseName', title: '基础模板', width: 80},
          {field: 'createdtimeYMD', title: '创建时间', width: 100},
          {field: 'beginTime', title: '开始时间', width: 100},
          {field: 'endTime', title: '结束时间', width: 100},
          {field: 'taskStatusName', title: '任务状态', width: 80},
          {field: 'note', title: '备注', width: 250}
        ]],
        //queryParams: { action: 'query' }, //查询参数
        toolbar:'#tb'
      });

      function formatOper(val, row, index) {
        return  '<a href="#" onclick="detailPop(' + index + ')">查看流转情况</a>   ' +
                '<a href="#" onclick="transPop(' + index + ')">下发</a>   ' +
                '<a href="#" onclick="editPop(' + index + ')">修改</a>   ' +
                '<a href="#" onclick="deletePop(' + index + ')">删除</a>   '+
                '<a href="#" onclick="showBitMatrix(' + index + ')">轮播演示二维码</a>   ';  
      }

      datagridX = $('#dataTableX').datagrid({
        //singleSelect:true,
        fit: true, //datagrid自适应宽度
        fitColumn: false, //列自适应宽度
        striped: true, //行背景交换
        nowap: true, //列内容多时自动折至第二行
        method:'get',
        idField: 'id', //主键
        //url: "${path}/fetask/queryTask",
        columns: [[
          {field: 'sort', title: '顺序', width: 50,editor : "numberbox"},
          {field: 'name', title: '字段', width: 100},
          {field: 'type', title: '类型', width: 70,
            formatter:function(value,row){
              return row.typeName;
            },
            editor:{
              type:'combobox',
              options:{
                //url:'${path}/fetask/queryTableType?type=coo_task_column_type',
                data:selectColumnData,
                valueField: 'type',
                textField: 'typeName',
                //valueField: 'type',
                //textField: 'typeName',
                onSelect: function(rec){
                },
                onChange:function(newValue, oldValue){
                  changeText("type","typeName",datagridX);
                }
              }
            }
          },
          {field: 'itemType', title: '横纵', width: 60,
            formatter:function(value,row){
              return row.itemTypeName;
            },
            editor:{
              type:'combobox',
              options:{
                data:selectItemTypeData,
                valueField: 'itemType',
                textField: 'itemTypeName',
                //url:'${path}/fetask/queryTableItemType?type=coo_task_column_itemtype',
                //valueField: 'itemType',
                //textField: 'itemTypeName'
                onChange:function(newValue, oldValue){
                  changeText("itemType","itemTypeName",datagridX);
                }
              }
            }
          }
        ]],
        toolbar : [ {
          //text : "添加",
          iconCls : "icon-add",
          handler : function() {
            datagridX.datagrid('appendRow', {});
            var rows = datagridX.datagrid('getRows');
            datagridX.datagrid('beginEdit', rows.length - 1);
          }
        }, '-',{
          //text : "编辑",
          iconCls : "icon-edit",
          handler : function() {
            endEditX();
            if (datagridX.datagrid('getChanges').length) {
              datagridY.datagrid('acceptChanges');
            }
            var row = datagridX.datagrid('getSelected');
            if (row) {
              var rowIndex = datagridX.datagrid('getRowIndex', row);
              datagridX.datagrid('beginEdit', rowIndex);
            }
          }
        }, '-',{
          //text : "删除",
          iconCls : "icon-remove",
          handler : function() {
            var row = datagridX.datagrid('getSelected');
            if (row) {
              var rowIndex = datagridX.datagrid('getRowIndex', row);
              datagridX.datagrid('deleteRow', rowIndex);
            }
          }
        },'-', {
          //text : "保存",
          iconCls : "icon-save",
          handler : function() {
            endEditX();
            if (datagridX.datagrid('getChanges').length) {
              datagridY.datagrid('acceptChanges');
            }
          }
        }, '-',{
          //text : "横变纵",
          iconCls : "icon-toright",
          handler :x_to_y
        } ]
      });

      datagridY = $('#dataTableY').datagrid({
        //singleSelect:true,
        fit: true, //datagrid自适应宽度
        fitColumn: false, //列自适应宽度
        striped: true, //行背景交换
        nowap: true, //列内容多时自动折至第二行
        method:'get',
        //url: "${path}/fetask/queryTask",
        columns: [[
          {field: 'sort', title: '顺序', width: 50,editor : "numberbox"},
          {field: 'name', title: '字段', width: 100,editor : "validatebox"},
          {field: 'type', title: '类型', width: 70,
            formatter:function(value,row){
              return row.typeName;
            },
            editor:{
              type:'combobox',
                options:{
                  data:selectColumnData,
                  valueField: 'type',
                  textField: 'typeName',
                  onSelect: function(rec){
                  },
                  onChange:function(newValue, oldValue){
                    changeText("type","typeName",datagridY);
                  }
              }
            }
          },
          {field: 'itemType', title: '横纵', width: 60,
          formatter:function(value,row){
              return row.itemTypeName;
            },
            editor:{
              type:'combobox',
                  options:{
                    data:selectItemTypeData,
                    valueField: 'itemType',
                    textField: 'itemTypeName',
                    onChange:function(newValue, oldValue){
                      changeText("itemType","itemTypeName",datagridY);
                    }
              }
            }
          }
        ]],
        toolbar : [ {
          //text : "添加",
          iconCls : "icon-add",
          handler : function() {
            datagridY.datagrid('appendRow', {});
            var rows = datagridY.datagrid('getRows');
            datagridY.datagrid('beginEdit', rows.length - 1);
          }
        },'-', {
          //text : "编辑",
          iconCls : "icon-edit",
          handler : function() {
            endEditY();
            if (datagridY.datagrid('getChanges').length) {
              datagridY.datagrid('acceptChanges');
            }
            var row = datagridY.datagrid('getSelected');
            if (row) {
              var rowIndex = datagridY.datagrid('getRowIndex', row);
              datagridY.datagrid('beginEdit', rowIndex);
            }
          }
        }, '-',{
          //text : "删除",
          iconCls : "icon-remove",
          handler : function() {
            var row = datagridY.datagrid('getSelected');
            if (row) {
              var rowIndex = datagridY.datagrid('getRowIndex', row);
              datagridY.datagrid('deleteRow', rowIndex);
            }
          }
        },'-',{
          //text : "保存",
          iconCls : "icon-save",
          handler : function() {
            endEditY();
            if (datagridY.datagrid('getChanges').length) {
              datagridY.datagrid('acceptChanges');
            }
          }
        },'-', {
          //text : "横变纵",
          iconCls : "icon-toleft",
          handler :y_to_x
        }  ]
      });

      function endEditX(){
        var rows = datagridX.datagrid('getRows');
        //console.log(rows);
        for ( var i = 0; i < rows.length; i++) {
          datagridX.datagrid('endEdit', i);
        }
      }

      function endEditY(){
        var rows = datagridY.datagrid('getRows');
        //console.log(rows);
        for ( var i = 0; i < rows.length; i++) {
          datagridY.datagrid('endEdit', i);
        }
      }
    })

    //填充横向纵向列表数据
    function setXYData(dataX,dataY){
      $('#dataTableX').datagrid({
        data: dataX
      });
      $('#dataTableY').datagrid({
        data: dataY
      });
    }

    function newPop() {
      $('#editForm').form('clear');
      $('#editWin').window('open');
    }

    //修改编辑
    function editPop(index) {
     // debugger;
      $('#dataTable').datagrid('selectRow', index);
      var row = $('#dataTable').datagrid('getSelected');
      if (row) {
        console.log(row);
       	if(!row.contentModule){
       		delete row.contentModule;
       	} 
       	$('#editForm').form('clear');
        $('#editForm').form('load', row);
        $('#editWin').window('open');
      } else {
        $.messager.alert("提示", "请选择要编辑的行", "error");
      }
    }

    //打开下发界面
    function transPop(index) {
      $('#dataTable').datagrid('selectRow', index);
      var row = $('#dataTable').datagrid('getSelected');
      selectedRow = row;
      var tableIdStr = row.tablebaseID;
      if (row) {
        //获取任务模板
        $.ajax({
          type: "POST",
          url: "${path}/fetask/selectTableDetail",
          data: {tableId:tableIdStr},
          dataType: 'json',
          success: function (jsonStr) {
            $("#dataTableX").datagrid('loadData', { total: 0, rows: [] });
            $("#dataTableY").datagrid('loadData', { total: 0, rows: [] });
            dataX = new Array(),dataY = new Array();
            if (jsonStr.length==0) {
              layer.msg("未获取到任务模板数据", {time: 3000, icon: 6});
            }else{
              $.each(jsonStr, function (i,rec) {
                if(rec.itemType==0){//横向字段
                  dataX.push(rec)
                }else if(rec.itemType==1){//纵向字段
                  dataY.push(rec)
                }
              });
              //加载模板数据
              setXYData(dataX,dataY);
              //刷新用户树
              reflashTree();
            }
            $('#transWin').window('open');
          },
          error: function (jqXHR, textStatus, errorThrown) {
            layer.msg("与远程服务器交互异常", {time: 3000, icon: 6});
          }
        });
      } else {
        $.messager.alert("提示", "请选择要编辑的行", "error");
      }
    }

    function deletePop(index) {
      $('#dataTable').datagrid('selectRow', index);
      var row = $('#dataTable').datagrid('getSelected');
      if (row.id) {
        $.messager.confirm("提示", "你确定要删除吗?", function (r) {
          if (r) {
            $.ajax({
              type: "POST",
              url: "${path}/fetask/deleteTask",
              data: {id:row.id},
              dataType: 'json',
              //contentType: "application/json;charset=utf-8",
              success: function (text) {
                if (text.status == 1) {
                  layer.msg(text.msg, {time: 3000, icon: 6});
                  $('#dataTable').datagrid('reload');
                }
              },
              error: function (jqXHR, textStatus, errorThrown) {
                layer.msg("与远程服务器交互异常", {time: 3000, icon: 6});
              }
            });
          }
        });
      } else {
        $.messager.alert("提示", "请选择要删除的行", "error");
      }
    }

    function submitForm() {
      if ($('#editForm').form('enableValidation').form('validate')) {
        var formval = JsonCode(editForm);
        formval = JSON.parse(formval);
		
        var contentModule=$('#contentModule').combogrid('getValues');           
      	var titleModule=$('#titleModule').combogrid('getValues');     
      	
    	formval.contentModule=contentModule;
    	formval.titleModule=titleModule;

        var actionUrl = "${path}/fetask/saveTask";
        $.ajax({
          type: "POST",
          url: actionUrl,
          data: JSON.stringify(formval),
          dataType: 'json',
          contentType: "application/json;charset=utf-8",
          success: function (text) {
            if (text.status == 1) {
              $('#editForm').form('clear');
              $('#editWin').window('close');
              $('#dataTable').datagrid('reload');
            }
            layer.msg(text.msg, {time: 3000, icon: 6});
          },
          error: function (jqXHR, textStatus, errorThrown) {
            layer.msg("与远程服务器交互异常", {time: 3000, icon: 6});
          }
        });
      }
    }

    var layIndex;
    //添加计划字段
    function plantableData(taskUserID,tableType){
      var url = "/404";
      if(tableType=='1'){
        url = "${path}/tasktrans/dataIndex?isPlan=1&taskUserID="+taskUserID;
      }else if(tableType=='0'){
        url = "${path}/fetask/userValue?feTaskUserid="+taskUserID;
      }
      //console.log(url);
      if (taskUserID) {
        layIndex = layer.open({
          title:"扩展字段",
          type: 2,
          fix: false,
          maxmin: true,
          area: ['950px', '670px'],
          content: url,
          cancel: function(index){

          }
        });
      } else {
        $.messager.alert("提示", "请先选择一条记录", "error");
      }
    }

    //查看流转状态
    function detailPop(index){
      $('#dataTable').datagrid('selectRow', index);
      var row = $('#dataTable').datagrid('getSelected');
      if (row.id) {
        var url = "${path}/tasktrans/transInfo?taskID="+row.id;
        layIndex = layer.open({
          title:"流转明细",
          type: 2,
          fix: false,
          maxmin: true,
          area: ['1200px', '740px'],
          content: url,
          cancel: function(index){

          }
        });
      } else {
        $.messager.alert("提示", "请先选择一条记录", "error");
      }
    }

    document.onkeydown=function(event){
      var e = event || window.event || arguments.callee.caller.arguments[0];
      if(e && e.keyCode==13){ // enter 键
        searchContent();
      }
    }

    //查询
    var searchContent = function(){
      var seachform=$('#searchForm').form();
      $('#dataTable').datagrid('load',serializeObject(seachform));
    }

    var n_tableData
    //获取横纵列表数据
    function getXYdata(){
      n_tableData = new Array();
      var x_n_data = $('#dataTableX').datagrid('getData');
      var y_n_data = $('#dataTableY').datagrid('getData');
      $.each(x_n_data.rows,function(i,rec){
        n_tableData.push(rec);
      });
      $.each(y_n_data.rows,function(i,rec){
        n_tableData.push(rec);
      });
      return n_tableData;
    }

    //保存用户模板并下发
    function saveUserTable(){
      if(!selectedRow.id){
        return layer.msg("请先选择任务", {time: 3000, icon: 6});
      }
      //模板数据
      var tableData = getXYdata();//字段数组
      if(tableData.length==0){
        return layer.msg("模板字段不可为空", {time: 3000, icon: 6});
      }
      var postTableData = new Array();
      $.each(tableData,function(i,rec){
          var tableOne = {};
          tableOne.columnCode = rec.columnCode;
          tableOne.name = rec.name;
          tableOne.type = rec.type;
          tableOne.sort = rec.sort;
          tableOne.itemType = rec.itemType;
          tableOne.note = rec.note;
          postTableData.push(tableOne);
      })
      var zTree = $.fn.zTree.getZTreeObj("detptree");
      var checkd = zTree.getCheckedNodes(true);
      if(checkd.length==0){
        return layer.msg("请先选择需下发人员", {time: 3000, icon: 6});
      }
      var users = new Array();//用户数组
      $.each(checkd,function(i,rec){
        if(rec.datatype=="u"){
          var userOne = {};
          userOne.userId = rec.id;
          userOne.userName = rec.name;
          userOne.deptId = rec.deptId;
          userOne.deptName = rec.deptName;
          userOne.datatype = rec.datatype;
          users.push(userOne);
        }
      })

      var postData = {};
      postData.taskID = selectedRow.id;
      postData.tableColumns = postTableData;
      postData.feTaskUsers = users;
      //保存模板
      var actionUrl = "${path}/tasktrans/feTaskUserTableByBase";
      $.ajax({
        type: "POST",
        url: actionUrl,
        data: JSON.stringify(postData),
        dataType: 'json',
        contentType: "application/json;charset=utf-8",
        success: function (text) {
          reflashTree();
          layer.msg(text.msg, {time: 3000, icon: 6});
        },
        error: function (jqXHR, textStatus, errorThrown) {
          layer.msg("与远程服务器交互异常", {time: 3000, icon: 6});
        }
      });
    }

    //刷新用户树
    function reflashTree(){
      if(selectedRow.id){
        $.ajax({
          url: "${path}/tasktrans/easyTreeDeptUser?dept_id=${deptId}"+"&taskID="+selectedRow.id,
          success: function (text) {
            $.fn.zTree.init($("#detptree"), settingmenu, text);
          },
          error: function (jqXHR, textStatus, errorThrown) {
            toastr.info("与远程服务器交互异常，请规范操作或重新登录", "提示", toastrOptsBottom);
          }
        });
      }
    }

    //横元素转纵元素
    function x_to_y(){
      var selected = $('#dataTableX').datagrid('getSelections');
      $.each(selected,function(i,rec){
        console.log(rec);
        rec.itemType = 1;
        rec.itemTypeName = "纵向";
        $('#dataTableY').datagrid('appendRow',rec);
        var rowIndex = $('#dataTableX').datagrid('getRowIndex',rec);
        $('#dataTableX').datagrid('deleteRow',rowIndex);
      });
    }

    //纵元素转横元素
    function y_to_x(){
      var selected = $('#dataTableY').datagrid('getSelections');
      $.each(selected,function(i,rec){
        rec.itemType = 0;
        rec.itemTypeName = "横向";
        $('#dataTableX').datagrid('appendRow',rec);
        var rowIndex = $('#dataTableY').datagrid('getRowIndex',rec);
        $('#dataTableY').datagrid('deleteRow',rowIndex);
      });
    }

  </script>
</head>
<body>
<table id="dataTable" title="创建任务" class="easyui-datagrid" style="width:850px;height:500px"
       singleSelect="true" iconCls="icon-save">
</table>

<div id="editWin" class="easyui-window" title="编辑" style="width:600px;height:750px;padding:10px;"
     data-options="iconCls:'icon-save',modal:true,closed:true,top:60">
  <form id="editForm" name="editForm" method="post">
    <input type="hidden" name="id"/>
    <table cellpadding="5">
      <tr>
        <td style="width:100px">父任务:</td>
        <td><input class="easyui-combobox" id="parentId" name="parentId" style="width:250px;" data-options="
                            url:'${path}/fetask/selectTask',
                            valueField: 'id',
                            textField: 'title'
                            "></td>
      </tr>
      <tr>
        <td>标题:</td>
        <td><input class="easyui-textbox" type="text" name="title" style="width:150px"
                   data-options="required:true,prompt:'请填写标题'"/></td>
      </tr>
      <tr>
        <td>类型:</td>
        <td>
          <input class="easyui-combobox" id="taskType" name="taskType" style="width:150px;" data-options="
                            url:'${path}/common/getBaseCodeList?type=coo_task_type',
                            valueField: 'code',
                            textField: 'name',
                            required:true
                            ">
        </td>
      </tr>
      <tr>
        <td>等级:</td>
        <td>
          <input class="easyui-combobox" id="taskLevel" name="taskLevel" style="width:150px;" data-options="
                            url:'${path}/common/getBaseCodeList?type=coo_task_level',
                            valueField: 'code',
                            textField: 'name',
                            required:true
                            ">
        </td>
      </tr>
      <tr>
        <td>模板</td>
        <td>
          <input class="easyui-combobox" id="tablebaseID" name="tablebaseID" style="width:150px;"
                 data-options="
                            url:'${path}/cootasktable/tablebases',
                            valueField: 'id',
                            textField: 'name',
                          	method:'get',
                          	prompt:'将删除原有扩展字段'
                            ">
          <input class="easyui-combobox" id="tableType" name="tableType" style="width:60px;"
                 data-options="
                            url:'${path}/common/getBaseCodeList?type=coo_task_table_type',
                            valueField: 'code',
                            textField: 'name',
                            required:true
                            ">
        </td>
      </tr>
      
      <tr>  
        <td>标题模板</td>
        <td>
          <input class="easyui-combogrid" id="titleModule" name="titleModule" style="width:330px;"
                 data-options="
                 			idField:'id',
                            url:'${path}/fetask/femodule?type=1',
                            valueField: 'id',
                            textField: 'title',
                          	method:'get',
   							multiple:false,
                          	prompt:'将删除原有标题模板',
                          	columns:[[
                          			{field:'id',checkbox:true},
							        {field:'title',title:'标题',width:100},
							        {field:'content',title:'内容',width:200}
    								]]
                            ">

      	</td>
     </tr> 	

      <tr>  
        <td>内容模板</td>
        <td>
          <input class="easyui-combogrid" id="contentModule" name="contentModule" style="width:330px;"
                 data-options="
                 			idField:'id',
                            url:'${path}/fetask/femodule?type=2',
                            valueField: 'id',
                            textField: 'title',
                          	method:'get',
   							multiple:true,
                          	prompt:'将删除原有内容模板',
                          	columns:[[
                          			{field:'id',checkbox:true},
							        {field:'title',title:'标题',width:100},
							        {field:'content',title:'内容',width:200}
    								]]
                            ">
      	</td>
     </tr> 	  		
      
      <tr>  
        <td>背景模板</td>
        <td>
          <input class="easyui-combobox" id="febackgroundID" name="febackgroundID" style="width:150px;"
                 data-options="
                            url:'${path}/fetask/febackground',
                            valueField: 'id',
                            textField: 'title',
                          	method:'get',
                          	prompt:'将删除原有背景模板'
                            ">
      	</td>
     </tr> 	
      	

      <tr>
        <td>开始时间:</td>
        <td>
          <input type="text" name="beginTime" id="beginTime" class="mytextbox"
                 onFocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" style="width:150px">
        </td>
      </tr>
      <tr>
        <td>结束时间:</td>
        <td>
          <input type="text" name="endTime" id="endTime" class="mytextbox"
                 onFocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" style="width:150px">
        </td>
      </tr>
      <tr>
        <td>内容:</td>
        <td><input class="easyui-textbox" name="content" data-options="multiline:true"
                   style="height:80px;width:400px"/></td>
      </tr>
      <tr>
        <td>目标:</td>
        <td><input class="easyui-textbox" name="goal" data-options="multiline:true"
                   style="height:80px;width:400px"/></td>
      </tr>
      <tr>
        <td>任务备注:</td>
        <td><input class="easyui-textbox" name="note" data-options="multiline:true"
                   style="height:80px;width:400px"/></td>
      </tr>
    </table>
    <div style="text-align:right;margin-top:10px;padding-right:55px">
      <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save'" style="width:15%"
         onclick="submitForm()">保存</a>
      <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width:15%"
         onclick="javascript:$('#editWin').window('close')">关闭</a>
    </div>
  </form>
</div>

<div id="tb" >
  <form id="searchForm"  style="height:13px">
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newPop()">添加</a>

    <input class="easyui-textbox" type="text" id="titles" name="title" style="width:150px"
           data-options="prompt:'任务名'"/>
    <input class="easyui-combobox" id="taskTypes" name="taskType" style="width:150px;"
           data-options="
            url:'${path}/common/getBaseCodeList?type=coo_task_type',
            valueField: 'code',
            textField: 'name',
			prompt:'任务类型'            
            ">
    <input class="easyui-combobox" id="taskLevels" name="taskLevel" style="width:150px;"
           data-options="
            url:'${path}/common/getBaseCodeList?type=coo_task_level',
            valueField: 'code',
            textField: 'name',
			prompt:'任务等级'            
            ">

    <input class="easyui-combobox" id="taskStatuss" name="taskStatus" style="width:150px;"
           data-options="
            url:'${path}/common/getBaseCodeList?type=coo_task_status',
            valueField: 'code',
            textField: 'name',
			prompt:'任务状态'            
            ">

    <input type="text" name="beginTime" id="sbeginTime" class="mytextbox" placeholder="开始时间"
           onFocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" style="width:150px">

    <input type="text" name="endTime" id="sendTime" class="mytextbox" placeholder="结束时间"
           onFocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" style="width:150px">

    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="searchContent()">搜索</a>
  </form>
</div>

<div id="transWin" class="easyui-window" title="下发" style="width:950px;height:620px;padding:10px;"
     data-options="iconCls:'icon-save',modal:true,closed:true,top:60">
  <form id="transForm" name="transForm" method="post">
    <table cellpadding="5">
      <tr>
        <td>部门:</td>
        <td>模板配置:</td>
      </tr>
      <tr>
        <td>
          <div style="padding:10px;width:260px;height:450px;overflow-y:auto;border:1px solid #C3D9E0">
            <ul id="detptree" class="ztree"></ul>
          </div>
        </td>
        <td>
          <div style="float:left;width:290px;height:450px;padding:1px">
            <table id="dataTableX" title="项目选择" class="easyui-datagrid" style="width:290px;height:450px"
                   singleSelect="true">
            </table>
          </div>
          <div style="float:left;width:290px;height:450px;padding:1px">
            <table id="dataTableY" title="字段选择" class="easyui-datagrid" style="width:290px;height:450px"
                   singleSelect="true">
            </table>
          </div>
        </td>
      </tr>
    </table>
    <div style="text-align:right;margin-top:10px;padding-right:33px">
      <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reflash'" style="width:12%"
         onclick="reflashTree()">刷新用户树</a>
      <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save'" style="width:12%"
         onclick="saveUserTable()">保存</a>
      <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width:12%"
         onclick="javascript:$('#transWin').window('close')">关闭</a>
    </div>
  </form>
</div>
	<!-- <div style="display:none" id="tipdiv"> -->
	<div id="tipdiv" class="easyui-window" title="二维码" style="width:330px;height:340px"
        data-options="modal:true,closed:true">
		<img id="bitMatrix" src="" style="width:300px;height:300px"/>
	</div>
</body>
</html>
